package cn.cfoodc.sharding.service.impl;

import cn.cfoodc.sharding.controller.dto.OrderAndOrderItemDto;
import cn.cfoodc.sharding.controller.dto.OrderBingdingOrderItemDto;
import cn.cfoodc.sharding.domain.Order;
import cn.cfoodc.sharding.domain.TOrderItem;
import cn.cfoodc.sharding.mapper.OrderMapper;
import cn.cfoodc.sharding.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderMapper orderMapper;


    @Override
    public int deleteByPrimaryKey(Long orderId) {
        return orderMapper.deleteByPrimaryKey(orderId);
    }

    @Override
    public int insert(Order record) {
        return orderMapper.insert(record);
    }

    @Override
    public Order selectByPrimaryKey(Long orderId) {
        return orderMapper.selectByPrimaryKey(orderId);
    }

    @Override
    public int updateByPrimaryKey(Order record) {
        return orderMapper.updateByPrimaryKey(record);
    }

    @Override
    public OrderAndOrderItemDto selectOneByUseridAndOrderid(Long userId, Long orderId) {
        return orderMapper.selectOneByUseridAndOrderid(userId,orderId);
    }

    @Override
    public List<OrderBingdingOrderItemDto> selectAllOrderBingdingOrderItem( Long userId ,Long orderId) {
        return orderMapper.selectAllOrderBingdingOrderItem(userId ,orderId);
    }

    @Override
    public List<OrderBingdingOrderItemDto> selectAllOrderBingdingOrderItem2( Long userId , Long userId2) {
        return orderMapper.selectAllOrderBingdingOrderItem2( userId , userId2);
    }
}
